package com.coldchain.message;


import com.coldchain.message.webscoker.WebsocketStarter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@EnableAutoConfiguration
@EnableDiscoveryClient
@Controller
@ComponentScan({"com.fangliai","com.coldchain"})
@EnableFeignClients(value={"com.coldchain.authclient.feign", "com.coldchain.common.feign"})
public class MessageBootstrap {
    private static final Logger log= LoggerFactory.getLogger(MessageBootstrap.class);
    public static void main(String[] args) {
        SpringApplication.run(MessageBootstrap.class, args);
        try {
            WebsocketStarter.getInstance().start();
        }catch (Exception e){
            log.error("开启websocket服务失败，error:"+e.getMessage());
        }

    }

    @GetMapping("/msg/v2/api-docs")
    public String  apiDoc(){
        return "redirect:/v2/api-docs";
    }
}
